/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ec.socialfun.entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author hp
 */
@Entity
@Table(name = "tipo_local")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TipoLocal.findAll", query = "SELECT t FROM TipoLocal t"),
    @NamedQuery(name = "TipoLocal.findByTiLoCodigo", query = "SELECT t FROM TipoLocal t WHERE t.tiLoCodigo = :tiLoCodigo"),
    @NamedQuery(name = "TipoLocal.findByTiLoNombre", query = "SELECT t FROM TipoLocal t WHERE t.tiLoNombre = :tiLoNombre")})
public class TipoLocal implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "TI_LO_CODIGO")
    private Integer tiLoCodigo;
    @Basic(optional = false)
    @Column(name = "TI_LO_NOMBRE")
    private String tiLoNombre;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tiLoCodigo")
    private List<Local> localesList;

    public TipoLocal() {
    }

    public TipoLocal(Integer tiLoCodigo) {
        this.tiLoCodigo = tiLoCodigo;
    }

    public TipoLocal(Integer tiLoCodigo, String tiLoNombre) {
        this.tiLoCodigo = tiLoCodigo;
        this.tiLoNombre = tiLoNombre;
    }

    public Integer getTiLoCodigo() {
        return tiLoCodigo;
    }

    public void setTiLoCodigo(Integer tiLoCodigo) {
        this.tiLoCodigo = tiLoCodigo;
    }

    public String getTiLoNombre() {
        return tiLoNombre;
    }

    public void setTiLoNombre(String tiLoNombre) {
        this.tiLoNombre = tiLoNombre;
    }

    @XmlTransient
    public List<Local> getLocalesList() {
        return localesList;
    }

    public void setLocalesList(List<Local> localesList) {
        this.localesList = localesList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tiLoCodigo != null ? tiLoCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoLocal)) {
            return false;
        }
        TipoLocal other = (TipoLocal) object;
        if ((this.tiLoCodigo == null && other.tiLoCodigo != null) || (this.tiLoCodigo != null && !this.tiLoCodigo.equals(other.tiLoCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ec.socialfun.entidades.TipoLocal[ tiLoCodigo=" + tiLoCodigo + " ]";
    }
    
}
